home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / Textures SDK / common / cmdlib.h < prev    next >
C/C++ Source or Header  |  1998-12-02  |  3KB  |  150 lines

  1. /***
  2. *
  3. *    Copyright (c) 1998, Valve LLC. All rights reserved.
  4. *    
  5. *    This product contains software technology licensed from Id 
  6. *    Software, Inc. ("Id Technology").  Id Technology (c) 1996 Id Software, Inc. 
  7. *    All Rights Reserved.
  8. *
  9. ****/
  10.  
  11. // cmdlib.h
  12.  
  13. #ifndef __CMDLIB__
  14. #define __CMDLIB__
  15.  
  16. #include <stdio.h>
  17. #include <string.h>
  18. #include <stdlib.h>
  19. #include <errno.h>
  20. #include <ctype.h>
  21. #include <time.h>
  22. #include <stdarg.h>
  23.  
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28.  
  29. #ifndef __CMDUTIL__
  30. #define __CMDUTIL__
  31. #ifndef _NOENUMQBOOL
  32. typedef enum {false, true} qboolean;
  33. #else
  34. typedef int qboolean;
  35. #undef true
  36. #undef false
  37. #define true 1
  38. #define false 0
  39. #endif
  40.  
  41. typedef unsigned char byte;
  42. #endif
  43.  
  44. // the dec offsetof macro doesn't work very well...
  45. #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
  46.  
  47.  
  48. // set these before calling CheckParm
  49. extern int myargc;
  50. extern char **myargv;
  51.  
  52. char *strupr (char *in);
  53. char *strlower (char *in);
  54. int Q_strncasecmp (char *s1, char *s2, int n);
  55. int Q_strcasecmp (char *s1, char *s2);
  56. void Q_getwd (char *out);
  57.  
  58. int filelength (FILE *f);
  59. int    FileTime (char *path);
  60.  
  61. void    Q_mkdir (char *path);
  62.  
  63. extern    char        qdir[1024];
  64. extern    char        gamedir[1024];
  65. void SetQdirFromPath (char *path);
  66. char *ExpandArg (char *path);    // from cmd line
  67. char *ExpandPath (char *path);    // from scripts
  68. char *ExpandPathAndArchive (char *path);
  69.  
  70.  
  71. double I_FloatTime (void);
  72.  
  73. void    Error (char *error, ...);
  74. int        CheckParm (char *check);
  75.  
  76. FILE    *SafeOpenWrite (char *filename);
  77. FILE    *SafeOpenRead (char *filename);
  78. void    SafeRead (FILE *f, void *buffer, int count);
  79. void    SafeWrite (FILE *f, void *buffer, int count);
  80.  
  81. int        LoadFile (char *filename, void **bufferptr);
  82. void    SaveFile (char *filename, void *buffer, int count);
  83.  
  84. void     DefaultExtension (char *path, char *extension);
  85. void     DefaultPath (char *path, char *basepath);
  86. void     StripFilename (char *path);
  87. void     StripExtension (char *path);
  88.  
  89. void     ExtractFilePath (char *path, char *dest);
  90. void     ExtractFileBase (char *path, char *dest);
  91. void    ExtractFileExtension (char *path, char *dest);
  92.  
  93. int     ParseNum (char *str);
  94.  
  95. short    BigShort (short l);
  96. short    LittleShort (short l);
  97. int        BigLong (int l);
  98. int        LittleLong (int l);
  99. float    BigFloat (float l);
  100. float    LittleFloat (float l);
  101.  
  102. long flen(FILE* f);
  103.  
  104.  
  105.  
  106. char *COM_Parse (char *data);
  107.  
  108. extern    char        com_token[1024];
  109. extern    qboolean    com_eof;
  110.  
  111. char *copystring(char *s);
  112.  
  113.  
  114. void CRC_Init(unsigned short *crcvalue);
  115. void CRC_ProcessByte(unsigned short *crcvalue, byte data);
  116. unsigned short CRC_Value(unsigned short crcvalue);
  117.  
  118. void    CreatePath (char *path);
  119. void    QCopyFile (char *from, char *to);
  120.  
  121. extern    qboolean        archive;
  122. extern    char            archivedir[1024];
  123.  
  124.  
  125. extern    qboolean verbose;
  126. void qprintf (char *format, ...);
  127.  
  128.  
  129. typedef struct
  130. {
  131.     char    name[56];
  132.     int        filepos, filelen;
  133. } packfile_t;
  134.  
  135. typedef struct
  136. {
  137.     char    id[4];
  138.     int        dirofs;
  139.     int        dirlen;
  140. } packheader_t;
  141.  
  142.  
  143. void ListPak(char* pakname);
  144.  
  145. #endif
  146. #ifdef __cplusplus
  147. }
  148. #endif
  149.  
  150.